//*****************************************************************************
//
// File Name	: 'pb8515tiny.c'
// Title		: Board io initialization functions
// Author		: Sami Kukkonen - Copyright (C) 2011
// Created		: 22.6.2011
// Target MCU	: AT90S8515
// Editor Tabs	: 4
//
// This code is distributed under the GNU Public License
//		which can be found at http://www.gnu.org/licenses/gpl.txt
//
//*****************************************************************************

#include "pb8515tiny.h"

void pbInit(void)
{
	// Piezo pin data direction to output
	PB_PZ_DDR |= _BV(PB_PZ_PIN);
	// SW1 & SW2 pins to input (safe)
	PB_SW12_DDR &= ~_BV(PB_SW1_PIN) | ~_BV(PB_SW2_PIN);
	// SW3 & SW4 pins to input (safe)
	PB_SW34_DDR &= ~_BV(PB_SW3_PIN) | ~_BV(PB_SW4_PIN);
	
	// Disable piezo (active on low)
	PB_PZ_PORT |= _BV(PB_PZ_PIN);
	// Enable pull-up resistors for SW1 & SW2
	PB_SW12_PORT |= _BV(PB_SW1_PIN) | _BV(PB_SW2_PIN);
	// Enable pull-up resistors for SW3 & SW4
	PB_SW34_PORT |= _BV(PB_SW3_PIN) | _BV(PB_SW4_PIN);
}